import {
	defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {
	ElementPlusResolver
} from 'unplugin-vue-components/resolvers'
import {
	resolve
} from 'path'
import vueJsx from "@vitejs/plugin-vue-jsx";
import config from './config/env.js';

export default defineConfig({
	plugins: [
		vue(),
		vueJsx(),
		AutoImport({
			resolvers: [
				// 自动导入 Element Plus 组件
				ElementPlusResolver()
			],
		}),
		Components({
			resolvers: [
				// 自动导入 Element Plus 组件
				ElementPlusResolver()
			],
		}),
	],
	server: {
		/* host: '192.168.3.14',
		port: '5173', */
		proxy: {
			'/api': {
				target: config.API_BASE_URL + '/api',
				ws: true,
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, '')
			}
		}
	},
	resolve: {
		//路径配置@符号识别
		alias: {
			"@": resolve(__dirname, "./src"),
		}
	}
})